<?php
class Order_FileController extends Zend_Controller_Action {
	public function preDispatch(){
		$this->_s = new Order_Service_Order();
		$this->tplDirectory = "order/order/"; // 控制对应模板目录
	}
	
	public function indexAction(){
		$this->view->fileContent = "";
		$path = $this->getRequest()->getParam("file", "");
		$this->view->path = $path;
		
		$fileAbPath = $path;
		if(!preg_match("/^(\/var\/).*/",$path)){
			$fileAbPath = APPLICATION_PATH . "/../.." . $path;			
		}
		if ($this->_request->isPost()) {
			if (! empty($path) && is_file($fileAbPath) && file_exists($fileAbPath)) {
				$this->view->fileContent = file_get_contents($fileAbPath);
			} else {
				$this->view->fileContent = "非法参数，请输入文件路径，如：/admin/application/modules/order/controllers/FileController.php";
			}
		}
		
		echo Cff::renderTpl($this->tplDirectory . 'file.tpl', "layoutheader");
	
	}

}

